<template>
    <div>
        <p>产品分类添加</p>
        <p><input type="text" v-model="name"></p>
        <p><input type="text" v-model="status"></p>
        <p><input type="button" value="添加" @click="leitian()"></p>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    name:"leitian",
    data(){
        return{
            name:"",
            status:"",
        }
    },
    methods:{
        leitian(){
            var form_data = new FormData()
            form_data.append("name",this.name)
            form_data.append("status",this.status)
            axios({
                url:"http:127.0.0.1:8000/",
                method:"post",
                data:form_data
            }).then(res=>{
                console.log(res.data);
                if(res.data.code==200){
                    this.$router.push({path:""})
                }else{
                    alert("添加失败")
                }
            })
        }
    }
}
</script>

<style>

</style>
